<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>JS02</title>
</head>

<body>

    <div>
        <button>按钮1</button>
        <button>按钮2</button>
        <button>按钮3</button>
    </div>



    <script src="./sweetalert2.all.min.js"></script>


    <script>
        /*
        if("123"==123){
            Swal.fire({
                icon: 'success',
                title: '"123"==123',
                showConfirmButton: false,
                timer: 1500
            })
        }
        */

        if("123"===123){
            Swal.fire({
                icon: 'success',
                title: '"123"===123',
                showConfirmButton: false,
                timer: 1500
            })
        }else{
            Swal.fire({
                icon: 'error',
                title: '"123"===123',
                showConfirmButton: false,
                timer: 1500
            })
        }
        

        document.querySelector('button').onclick = function () {
            Swal.fire(
                '问题',
                '这是您的书吗？',
                'question'
            )
        };

        document.querySelector('button:nth-child(2)').onclick = function () {
            Swal.fire({
                icon: 'success',
                title: '保存成功！',
                showConfirmButton: false,
                timer: 1500
            })
        };

        document.querySelector('button:nth-child(3)').onclick = function () {
            Swal.fire({
                title: '您确实要删除这些数据吗?',
                text: "数据一旦删除，将不可恢复！",
                icon: 'warning',
                showCancelButton: true,
                confirmButtonColor: '#3085d6',
                cancelButtonColor: '#d33',
                confirmButtonText: '删除',
                cancelButtonText:'取消'
            }).then((result) => {
                if (result.value) {
                    Swal.fire(
                        '删除成功!',
                        '一共有10条数据被删除。',
                        'success'
                    )
                }
            })
        };




    </script>


</body>


</html>